package com.eqdd.yiqidian.ui.tongxunlu

import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.View
import com.eqdd.yiqidian.R
import com.eqdd.yiqidian.adapter.MyFragmentPagerAdapter
import com.eqdd.yiqidian.base.BaseActivity
import com.eqdd.yiqidian.base.Config
import kotlinx.android.synthetic.main.activity_relationship.*

/**
 * Created by jhj on 18-8-15.
 */
class RelationshipActivity : BaseActivity() {

    private var list: List<String>? = null
    private var fragment: List<Fragment>? = null


    override fun initBinding() {
        setContentView(R.layout.activity_relationship)
        initTopTitleBar(View.VISIBLE, "人脉")
    }

    override fun initData() {
        list = arrayListOf<String>("前同事", "校友", "老乡", "同行")
        fragment = arrayListOf<Fragment>(getFragment(0), getFragment(1),
                getFragment(2), getFragment(3))

    }

    override fun setView() {
        // 第二步：为ViewPager设置适配器
        vp_pager.adapter = MyFragmentPagerAdapter(supportFragmentManager, list, fragment)
        //  第三步：将ViewPager与TableLayout 绑定在一起
        tl_tab.setupWithViewPager(vp_pager)

    }


    fun getFragment(type: Int): Fragment {
        val bundle = Bundle()
        val fragment = RelationShipFragment()
        bundle.putString(Config.GUID, user.guid)
        bundle.putInt(Config.COMPANY_ID, user.companyId)
        bundle.putInt(Config.TYPE, type)
        fragment.arguments = bundle
        return fragment
    }

}